<script src="/static/js/jquery.min.js" charset="utf-8"></script>
<script src="/static/admin/js/layui.js" charset="utf-8"></script>
<script src="/static/js/vue.js" charset="utf-8"></script>
<script src="/static/js/fuck.js" charset="utf-8"></script>
<script>
    const PostCommon = {
        version: 10000,
        plat: 'admin',
        access_token: '{$access_token??""}'
    };
    function closewindow() {
        parent.closewindow();
    }

    function _alert(content, title = "系统提示", callback = null) {
        parent._alert(content, title, callback);
    }

    function _confirm(content, title = "系统提示", callback = null) {
        parent._confirm(content, title, callback)
    }

    function _loading(msg = "加载中") {
        parent._loading(msg);
    }

    function _hideLoading() {
        parent._hideLoading();
    }
    Date.prototype.Format = function (fmt) { //author: meizz
        var o = {
            "M+": this.getMonth() + 1,
            "d+": this.getDate(),
            "h+": this.getHours(),
            "m+": this.getMinutes(),
            "s+": this.getSeconds(),
            "q+": Math.floor((this.getMonth() + 3) / 3),
            "S": this.getMilliseconds()
        };
        if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
        for (var k in o)
            if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
        return fmt;
    };

    function time2string(nS) {
        return new Date(parseInt(nS) * 1000).Format("MM-dd hh:mm");
    }
    /**
     * 日期格式化 2019-07-23
     */
    function formatDate(date) {
        var myyear = date.getFullYear();
        var mymonth = date.getMonth() + 1;
        var myweekday = date.getDate();

        if (mymonth < 10) {
            mymonth = "0" + mymonth;
        }
        if (myweekday < 10) {
            myweekday = "0" + myweekday;
        }
        return (myyear + "-" + mymonth + "-" + myweekday); //想要什么格式都可以随便自己拼
    }
    /**
     * 将数值四舍五入(保留2位小数)后格式化成金额形式
     *
     * @param num 数值(Number或者String)
     * @return 金额格式的字符串,如'1,234,567.45'
     * @type String
     */
    function formatCurrency(num) {
        num = num.toString().replace(/\$|\,/g, '');
        if (isNaN(num))
            num = "0";
        var sign = (num == (num = Math.abs(num)));
        num = Math.floor(num * 100 + 0.50000000001);
        var cents = num % 100;
        num = Math.floor(num / 100).toString();
        if (cents < 10)
            cents = "0" + cents;
        for (var i = 0; i < Math.floor((num.length - (1 + i)) / 3); i++)
            num = num.substring(0, num.length - (4 * i + 3)) + ',' + num.substring(num.length - (4 * i + 3));
        return (((sign) ? '' : '-') + num + '.' + cents);
    }

    function parseTimes(timestamp) {
        var d = new Date(timestamp * 1000); //根据时间戳生成的时间对象
        var date = "";
        // date += (d.getFullYear()) + "-";
        var _month = d.getMonth() + 1;
        date += (_month < 10 ? ("0" + _month) : _month) + "-";
        date += (d.getDate() < 10 ? ("0" + d.getDate()) : d.getDate()) + " ";
        date += (d.getHours() < 10 ? ("0" + d.getHours()) : d.getHours()) + ":";
        date += (d.getMinutes() < 10 ? ("0" + d.getMinutes()) : d.getMinutes());
        // date += (d.getSeconds());
        return date;
    }

    function parseDate(timestamp) {
        var d = new Date(timestamp * 1000); //根据时间戳生成的时间对象
        var date = "";
        date += (d.getFullYear()) + "-";
        var _month = d.getMonth() + 1;
        date += (_month < 10 ? ("0" + _month) : _month) + "-";
        date += (d.getDate() < 10 ? ("0" + d.getDate()) : d.getDate());
        return date;
    }

    function parseDatetime(timestamp) {
        var d = new Date(timestamp * 1000); //根据时间戳生成的时间对象
        var date = "";
        date += (d.getFullYear()) + "-";
        var _month = d.getMonth() + 1;
        date += (_month < 10 ? ("0" + _month) : _month) + "-";
        date += (d.getDate() < 10 ? ("0" + d.getDate()) : d.getDate()) + " ";
        date += (d.getHours() < 10 ? ("0" + d.getHours()) : d.getHours()) + ":";
        date += (d.getMinutes() < 10 ? ("0" + d.getMinutes()) : d.getMinutes()) + ":";
        date += (d.getSeconds() < 10 ? ("0" + d.getSeconds()) : d.getSeconds());
        return date;
    }

    function parseDatetimeSimple(timestamp) {
        var d = new Date(timestamp * 1000); //根据时间戳生成的时间对象
        var date = "";
        var _month = d.getMonth() + 1;
        date += (_month < 10 ? ("0" + _month) : _month) + "-";
        date += (d.getDate() < 10 ? ("0" + d.getDate()) : d.getDate()) + " ";
        date += (d.getHours() < 10 ? ("0" + d.getHours()) : d.getHours()) + ":";
        date += (d.getMinutes() < 10 ? ("0" + d.getMinutes()) : d.getMinutes());
        return date;
    }

    function nowDateTimeSimple() {
        var d = new Date(); //根据时间戳生成的时间对象
        var date = "";
        var _month = d.getMonth() + 1;
        date += (_month < 10 ? ("0" + _month) : _month) + "-";
        date += (d.getDate() < 10 ? ("0" + d.getDate()) : d.getDate()) + " ";
        date += (d.getHours() < 10 ? ("0" + d.getHours()) : d.getHours()) + ":";
        date += (d.getMinutes() < 10 ? ("0" + d.getMinutes()) : d.getMinutes());
        return date;
    }

    function nowdate() {
        var d = new Date(); //根据时间戳生成的时间对象
        var date = "";
        var _month = d.getMonth() + 1;
        date += (d.getFullYear()) + "-";
        date += (_month < 10 ? ("0" + _month) : _month) + "-";
        date += (d.getDate() < 10 ? ("0" + d.getDate()) : d.getDate());
        return date;
    }
</script>